﻿--
--
IF EXISTS (SELECT name FROM sysobjects WHERE name = 'dsZeusOpenSupplyItem' AND type = 'P')
BEGIN
  DROP PROCEDURE dsZeusOpenSupplyItem
END
GO

-- HU - Nyitott beszállítás tételek
-- EN - Open Supply Items
--
CREATE PROCEDURE dsZeusOpenSupplyItem
(@AccessToken INTEGER)
 AS
BEGIN
  DECLARE
    @Err INTEGER,
    @Rows INTEGER,
    @UserID INTEGER,
    @Lang NVARCHAR(10)

  EXEC @Err = spAccessTokenCheck @AccessToken, @UserID OUTPUT, @Lang OUTPUT

  IF (@Err != 0)
    GOTO __ERROR__


  -- HU - Nyitott beszállítások
  -- EN - Open supplies
  --

  SELECT TOP 20 

         si.ID, ArticleCode, ArticleName, Expired, Quantity, UnitCode, N'' Notes

    FROM ZeusSupply s
    JOIN ZeusSupplyItem si ON s.ID = si.SupplyID
   WHERE s.Status = 'O'

-- Well done.
--
  RETURN(0)

-- We have a problem !
--
__ERROR__:
  RETURN(1)
END
GO
